package inventory.config.spring;

import inventory.config.web.Swagger2Config;
import org.springframework.context.annotation.ComponentScan;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.*;



@Component
@ComponentScan(
        basePackages = {"inventory.controller"},
        basePackageClasses = {Swagger2Config.class}
        )
@EnableWebMvc
public class WebmvcConfig implements WebMvcConfigurer {
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").allowedOrigins("*");
    }
}
